package com.sibu.yx.promotion.persistence.support;

import lombok.extern.slf4j.Slf4j;

/**
 * @author yuwenbo
 * @create 2019-04-08 16:42
 **/
@Slf4j
public class DynamicDataSourceContextHolder {

    private static final ThreadLocal<String> CONTEXT_HOLDER=new InheritableThreadLocal<>();


    public static String getDataSourceKey(){
        return CONTEXT_HOLDER.get();
    }


    public static void setDataSourceKey(String key) {
        CONTEXT_HOLDER.set(key);
    }

    public static void clearDataSourceKey() {
        CONTEXT_HOLDER.remove();
    }
}
